<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>1-ajax简单封装</title>
  </head>
  <body>
    <ul></ul>
    <script src="./ajax.js"></script>
    <script>
        ajax('http://localhost:8081/prodcuts/A?price=21').then(value => {
          const list = value.reduce((pre, p) => pre + `<li>${p.id}---${p.name}---${p.price}</li>`,'');
          document.querySelector('ul').innerHTML = list;

        }, error => {
          alert(error.message)
        })

    </script>

  </body>
</html>
